package com.zqm.experiment3.Controller;


import com.zqm.experiment3.Pojo.COVID19DataList;
import com.zqm.experiment3.Service.COVID19MsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
public class COVID19MsgController {

    @Autowired
    COVID19MsgService covid19MsgService;

    @GetMapping("/")
    public String getCovid19Msg(Model model,  @RequestParam(required = false) String region) {
        COVID19DataList covid19Msg = covid19MsgService.getCovid19Msg(region);
        model.addAttribute("covid19Msg", covid19Msg);
        return "index";
    }
}
